package com.example.manage_dzensaas.controller.invoke;

import com.example.manage_dzensaas.pojo.bo.AllProductsBo;
import com.example.manage_dzensaas.pojo.entity.db1.ProductInfo;
import com.example.manage_dzensaas.pojo.result.ApiResult;
import com.example.manage_dzensaas.service.ProductInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.noear.solon.annotation.*;

import java.util.List;

/**
 * @author wangzhiqi
 * @version 1.0
 * @description: 外调商品管理
 * @date 2025/1/16 14:29
 */
@Api("外调商品管理")
@Controller
@Mapping("/invoke/goods")
public class GoodsInvokeController {

    @Inject
    ProductInfoService productInfoService;

    @ApiOperation(value = "查询所有商品V2", notes = "查询最新添加的10条商品，主要用来查询测试数据V2")
    @Get
    @Mapping("/allV2")
    public ApiResult<List<ProductInfo>> getAllProductsV2(@ApiParam(value = "查询条件", required = true)
                                                         @Body AllProductsBo allProductsBo) {
        List<ProductInfo> products = productInfoService.findAll(allProductsBo);
        return ApiResult.success(products);
    }
}
